#! /bin/zsh

# git add .
# git commit -m "update at `date` "
# echo "1.push..."
# git push
# echo "1.push end."

echo "1.yarn build."
yarn build
echo "1.yarn end."
echo "2.tar dist."
tar zcvf dist.tar.gz dist
echo "3.copy to s12 start..."
scp -r dist.tar.gz s12:/root/deploy/aiact-h5/
echo "3.copy to s12 end."
rm -rf dist.tar.gz

ssh s12 > /dev/null 2>&1 << eeooff
cd /root/deploy/aiact-h5/
rm -rf dist
tar -zxvf dist.tar.gz
rm -rf dist.tar.gz
rm -rf /usr/share/nginx/aiact-h5
mv dist /usr/share/nginx/aiact-h5

exit
eeooff

echo "aiact-h5 deploy end."
